﻿@* Generator: MvcHelper *@
@using System.Web.Mvc.Ajax
@helper Spoiler(this System.Web.Mvc.AjaxHelper ajax, string caption, string action, string controller, object args = null)
{  
    var id = Guid.NewGuid().ToString("N"); 
    
    <fieldset>
        <legend class="spoilerLegend">@caption</legend>
        <div id="@id" class="spoiler">
            <div style="text-align:center">
                @ajax.ActionLink("Показать '" + caption + "'", action, controller, args, new AjaxOptions() { 
                    UpdateTargetId = id,                     
                    InsertionMode = InsertionMode.Replace, 
                    OnBegin="$('#" + id + "').html('<img src=http://habrastorage.org/storage2/326/a93/4b7/326a934b755a9fa1b0255aa8624735bb.gif />')", 
                    OnComplete="addTooltip('#" + id +" .TitleImg');" }, 
                    new { @class = "spoilerLink" }
                )
            </div>
        </div>
    </fieldset>
}


@helper HeroByGroup(this HtmlHelper helper, IEnumerable<DotaHelp.Models.Hero> heroes, Func<DotaHelp.Models.Hero, System.Web.Mvc.MvcHtmlString> template)
{
    var groups = new string[][]{
        new[]{"Sentinel Strength","Scourge Strength"},
		new[]{"Sentinel Agility","Scourge Agility"},
        new[]{"Sentinel Intelligence","Scourge Intelligence"}				
    };
    
    var materialize = heroes.ToArray();
    
    <h2>Все герои Dota 6.78c</h2>
    
    <table border=0 style='margin-left:auto; margin-right:auto;'>
        @foreach (var row in groups)
        {
            <tr>
                @foreach (var col in row)
                {
                    <td  style='text-align:left;vertical-align:top;'>
                        <div style='text-align:center;color:gray;margin-top:15px'>@col</div>
                        @foreach (var hero in materialize.Where(m => m.Clan == col))
                        {
                            @template(hero)
                        }
                    </td>
                }
            </tr>
        }
    </table>
}